xportethxe 2.2.1
Loading...
Searching...
No Matches
xportethxe


XPort ETH XE Click

XPort ETH XE Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Stefan Filipovic
  • Date : Jan 2025.
  • Type : UART type

Software Support

Example Description

This example demonstrates the use of the XPort ETH XE Click board for Ethernet communication. The application initializes the XPort ETH XE module, retrieves essential information such as firmware version, MAC address, and network status, and demonstrates sending a ping command. It also allows for bidirectional UART communication between the USB UART and the XPort ETH XE UART.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.XPortETHXE

Example Key Functions

Application Init

Initializes the UART communication, logs essential information, configures the XPort ETH XE module, and retrieves the firmware version, MAC address, and network status. It also demonstrates basic command operations such as pinging the specific IP address (8.8.8.8).

void application_init ( void )
{
log_cfg_t log_cfg;
xportethxe_cfg_t xportethxe_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
xportethxe_cfg_setup( &xportethxe_cfg );
if ( UART_ERROR == xportethxe_init( &xportethxe, &xportethxe_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_printf( &logger, ">>> Reset Device to Monitor Mode <<<\r\n" );
xportethxe_reset_device ( &xportethxe );
xportethxe_send_enter ( &xportethxe );
xportethxe_read_response ( &xportethxe );
log_printf( &logger, "\r\n-----------------------------\r\n" );
log_printf( &logger, ">>> Query Firmware Version <<<\r\n" );
xportethxe_read_response ( &xportethxe );
log_printf( &logger, "\r\n-----------------------------\r\n" );
log_printf( &logger, ">>> Get MAC Address <<<\r\n" );
xportethxe_read_response ( &xportethxe );
log_printf( &logger, "\r\n-----------------------------\r\n" );
log_printf( &logger, ">>> Get Network Status and IP Address <<<\r\n" );
log_printf( &logger, ">>> Send QU Command to Exit Monitor Mode and Connect to Listed <<<\r\n" );
log_printf( &logger, ">>> IP Address Through Web Browser to Access Web Interface <<<\r\n" );
xportethxe_read_response ( &xportethxe );
log_printf( &logger, "\r\n-----------------------------\r\n" );
log_printf( &logger, ">>> Ping 8.8.8.8 and Switch to UART Terminal Commands Input <<<\r\n" );
xportethxe_send_cmd ( &xportethxe, XPORTETHXE_CMD_PING( "8.8.8.8" ) );
xportethxe_send_enter ( &xportethxe );
xportethxe_read_response ( &xportethxe );
}
#define XPORTETHXE_CMD_QUERY_FW_VERSION
Definition xportethxe.h:123
#define XPORTETHXE_CMD_NET_STAT
Definition xportethxe.h:98
#define XPORTETHXE_CMD_MODE_MONITOR_WITH_NET
Definition xportethxe.h:75
#define XPORTETHXE_CMD_PING(ADR)
Definition xportethxe.h:99
#define XPORTETHXE_CMD_GET_MAC_ADDRESS
Definition xportethxe.h:96
#define XPORTETHXE_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition xportethxe.h:161
void application_init(void)
Definition main.c:85
#define MIKROBUS_POSITION_XPORTETHXE
Definition main.c:41

Application Task

Continuously reads data from the USB UART and forwards it to the XPort ETH XE module, while also capturing responses from the module and forwarding them back to the USB UART. This allows real-time interaction with the device through the UART Terminal for configuration and diagnostics.

void application_task ( void )
{
app_buf_len = uart_read( &logger.uart, app_buf, PROCESS_BUFFER_SIZE );
if ( app_buf_len > 0 )
{
uart_write ( &xportethxe.uart, app_buf, app_buf_len );
xportethxe_clear_app_buf ( );
}
app_buf_len = uart_read( &xportethxe.uart, app_buf, PROCESS_BUFFER_SIZE );
if ( app_buf_len > 0 )
{
uart_write ( &logger.uart, app_buf, app_buf_len );
xportethxe_clear_app_buf ( );
}
}
void application_task(void)
Definition main.c:142
#define PROCESS_BUFFER_SIZE
Definition main.c:46

Note

Ensure the XPort ETH XE Click board is properly connected to the network.

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.